﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Project.Engine.Control;
using Project.Engine.Utilities;
using Project.Module.Model;
using Project.Module.DAO.BL;

namespace Project.Module.View
{
    public class ChiTietSuKienView : DocumentInfo
    {
        public EventModel detailEvent = null;
        public List<FeedBackModel> comment = null;
        private EventBL eventBl = new EventBL();
        private FeedBackBL feedbackBl = new FeedBackBL();

        public ChiTietSuKienView(int nodeid, string nodealias)
        {
            Init(nodeid);
        }

        private void Init(int nodeid)
        {
            GetDetailEvent(nodeid);
            GetComment(nodeid);
        }

        private void GetDetailEvent(int idEvent){
            this.detailEvent = eventBl.GetDetailEvent(idEvent);
            if (this.detailEvent != null)
            {
                this.detailEvent.ImagePath = eventBl.GetImagePathById(this.detailEvent.ImageID);
                this.detailEvent.title = StringUtil.ShortContent(this.detailEvent.Description, 5);
            }
        }

        protected void GetComment(int idEvent) {
            this.comment = feedbackBl.GetCommentEvent(idEvent);
        }
    }
}
